Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ability to add labels to Cluster object #809

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wahabmk
Copy link
Contributor

@wahabmk wahabmk commented Dec 18, 2024

Description

Provide ability to add labels to the Cluster object created when installing a clusterTemplate by:

  1. Adding .Values.ClusterLabels to all clusterTemplate helm charts.
  2. Using ManagedCluster's own labels via the HMC controller if none have been defined in .Values.ClusterLabels.

Testing

As can be seen from the output below, the .metadata.labels from ManagedCluster have been added to the Cluster object:

~ kubectl -n hmc-system get managedclusters.hmc.mirantis.com wali-dev-1 --show-labels
NAME         READY   STATUS                    LABELS
wali-dev-1   True    ManagedCluster is ready   labelA=A,labelB=B
➜  ~~~ kubectl -n hmc-system get cluster --show-labels                                
NAME         CLUSTERCLASS   PHASE         AGE   VERSION   LABELS
wali-dev-1                  Provisioned   13m             app.kubernetes.io/managed-by=Helm,helm.toolkit.fluxcd.io/name=wali-dev-1,helm.toolkit.fluxcd.io/namespace=hmc-system,labelA=A,labelB=B,sveltos-agent=present

@wahabmk wahabmk force-pushed the custom-labels-managed-cluster branch 2 times, most recently from 805f843 to f080795 Compare December 18, 2024 18:12
@wahabmk wahabmk changed the title WIP Provide ability to add labels to Cluster object Dec 18, 2024
@wahabmk wahabmk self-assigned this Dec 18, 2024
@wahabmk wahabmk linked an issue Dec 18, 2024 that may be closed by this pull request
@wahabmk wahabmk force-pushed the custom-labels-managed-cluster branch from f080795 to 3475d9c Compare December 18, 2024 18:23
@wahabmk wahabmk marked this pull request as ready for review December 18, 2024 18:42
@wahabmk wahabmk force-pushed the custom-labels-managed-cluster branch from 3475d9c to 44b336c Compare December 18, 2024 23:09
Copy link
Member

@zerospiel zerospiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, 2 charts-related-mostly-nit comments

templates/cluster/vsphere-standalone-cp/values.yaml Outdated Show resolved Hide resolved
@wahabmk wahabmk force-pushed the custom-labels-managed-cluster branch 2 times, most recently from 651f907 to b5a7452 Compare December 19, 2024 21:48
@wahabmk wahabmk requested a review from zerospiel December 19, 2024 22:39
@wahabmk wahabmk force-pushed the custom-labels-managed-cluster branch from b5a7452 to 1f07334 Compare December 20, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Set labels on Cluster object via ManagedCluster
2 participants